package com.yuanxiao.demo.controller;

import com.yuanxiao.demo.service.IDemoService;
import com.yuanxiao.mvcframework.annotations.LagouAutowired;
import com.yuanxiao.mvcframework.annotations.LagouController;
import com.yuanxiao.mvcframework.annotations.LagouRequestMapping;
import com.yuanxiao.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@LagouController
@LagouRequestMapping("/demo")
@Security({"xiaoming"})
public class DemoController {
    @LagouAutowired
    private IDemoService iDemoService;

    @LagouRequestMapping("/query")
    @Security({"xiaohong"})
    public String  query(String name, HttpServletRequest request, HttpServletResponse response){

        try {
            response.setContentType("text/html;charset=utf-8");
            response.getWriter().write("访问权限query成功");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return  null;
    }

    @LagouRequestMapping("/get")
    public String  get(String name, HttpServletRequest request, HttpServletResponse response){
        try {
            response.setContentType("text/html;charset=utf-8");
            response.getWriter().write("访问权限get成功");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return  null;

    }
}
